<!-- 列表组件 -->
<template>
  <div class="list">
    <ul>
      <li v-for="list in categoryListDatas" :key="list.goods_id">
        <div class="img">
          <img :src="list.goods_thumb" alt />
        </div>
        <div>
          <div class="title">{{list.goods_name}}</div>
          <div class="price">{{list.shop_price}}</div>
        </div>
      </li>
    </ul>
    <div class="loading" v-if="isLoading">
      <img src="@/assets/images/loading.gif" alt />
      <span>玩命加载中...</span>
    </div>
    <div class="loading" v-else>
      <span>俺也是有底线的</span>
    </div>
    <div style="height:5rem"></div>
  </div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';

export default {
  //import引入的组件需要注入到对象中才能使用
  components: {},
  props: {
    categoryListDatas: Array,
    isLoading: Boolean,
  },
  data() {
    //这里存放数据
    return {};
  },
};
</script>
<style lang="less">
.list {
  ul {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-top: 1rem;
    li {
      width: 48%;
      background: #fff;
      margin-bottom: 1rem;
      border-radius: 1rem;
      overflow: hidden;
      height: 26.5rem;
      img {
        width: 100%;
        height: 17rem;
      }
      .title {
        font-size: 1.4rem;
        height: 4rem;
        line-height: 2rem;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
      }
      .price {
        font-size: 1.8rem;
        color: #f55;
        line-height: 3rem;
        &::before {
          content: "￥";
        }
      }
    }
  }
  .loading {
    width: 100%;
    height: 5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    img {
      width: 3rem;
      height: 3rem;
    }
    span {
      font-size: 1.4rem;
      color: #999;
      margin-left: 1rem;
    }
  }
}
</style>